package com.jjx.service.impl;

import com.jjx.dao.IRoleMapper;
import com.jjx.domain.Role;
import com.jjx.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Collections;
import java.util.List;

@Service
public class RoleServiceImpl implements IRoleService {

    @Autowired
    private IRoleMapper iRoleMapper;

    @Override
    public List<Role> findAllById(Integer id) {
        Example example = new Example(Role.class);
        Example.Criteria criteria = example.createCriteria();
        if (id!=null&&!"".equals(id)){
            criteria.andNotIn("id", Collections.singleton(id));
        }
        List<Role> roleList = iRoleMapper.selectByExample(example);
        return roleList;
    }
}
